package cn.morge.springbootquartz.timetask;

import org.quartz.JobExecutionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author 麻贵海
 * 创建时间:2018/08/05 21:20
 * 项目名称:esim
 * @version 1.0
 * @since JDK 1.8
 * 类说明: 商品添加定时任务
 */
public class GoodAddTimer extends QuartzJobBean {

    static Logger logger = LoggerFactory.getLogger(GoodAddTimer.class);

    /**
     * 定时任务逻辑实现方法，每当任务执行时会触发该方法
     *
     * @param jobExecutionContext 任务执行上下文
     */
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        logger.info("商品添加完成后执行任务，任务时间：{}", sdf.format(new Date()));
    }
}
